#the player class, this holds each player's info, including scores, mouse pos etc.
class player_c:
    def __init__(self, name="Player", totalCreeps=1, number=0, spawnRate=30):
        self.name = name
        self.number = number
        print "Added player number: " + str(self.number)
        
        self.score=0
        
        #entrance maintenance
        self.entrances=[]
        self.nextEntrance=0
        self.lastEntrance=0

        #creeps stuff
        self.creeps=[]
        self.creepsRescued=0
        self.creepsReleased=0
        self.totalCreeps=totalCreeps
        
        #offset the spawn timer by player
        self.spawnTimer = number * (spawnRate/2)
        self.spawnRate = spawnRate
        
        #mouse and clicking vars
        self.reqAction=None
        self.selectedAction=0
        self.clickAction=0
        self.mouse=(0,0)

    def addCreep(self, creep):
        self.nextEntrance += 1
        if self.nextEntrance >= len(self.entrances):
            self.nextEntrance = 0
        
        self.creeps += [creep]
        self.creepsReleased += 1
    
    #add the entrancee to the player's list of usable entrances
    def useEntrance(self, entrance):
        #print "Player " + str(self.number) + " added usable entrance:" + str(entrance)
        self.entrances += [entrance]

    def getNextEntrance(self):
        return self.entrances[self.nextEntrance]

    def incScore(self, scoreIncrement = 1):
        self.score += scoreIncrement
    
    def checkSpawn(self):
        if self.creepsReleased < self.totalCreeps:
            if self.spawnTimer > self.spawnRate:
                self.spawnTimer = 0
                return True
            else:
                self.spawnTimer += 1
                return False
